package net.mingsoft.basic.util;

public class CalculationUtil
{
    public static String convertSpaceUnit(long size) {
        if (size < 1024L) {
            return String.valueOf(size) + "KB";
        }
        size /= 1024L;
        if (size < 1024L) {
            size *= 100L;
            return String.valueOf(size / 100L) + "." + String.valueOf(size % 100L) + "MB";
        }
        size = size * 100L / 1024L;
        return String.valueOf(size / 100L) + "." + String.valueOf(size % 100L) + "GB";
    }
}
